package com.zys.exercise;

public class cook extends Thread{
    @Override
    public void run() {
        while (true){
            synchronized (desk.lock){
                if(desk.flag==1){
                    try {
                        desk.lock.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }

                }else{
                    if (desk.count==0){
                        break;
                    }else{
                        System.out.println("做了一碗面条");
                        desk.flag=1;
                        desk.lock.notifyAll();
                    }
                }
            }
        }
    }
}
